package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 批量插入套餐菜品关系数据
     * @param dishes1
     */
    void insertBatch(List<SetmealDish> dishes1);

    /**
     * 根据套餐id批量删除套餐菜品关系
     * @param setmealIds
     * @return
     */
    void deleteBySetmealId(List<Long> setmealIds);

    /**
     * 根据套餐id查询菜品id
     * @param id
     * @return
     */
    @Select("select dish_id from setmeal_dish where setmeal_id = #{id}")
    Long findDishIdBySetmealId(Long id);

    /**
     * 根据菜品id删除套餐菜品关系
     * @param dishId
     * @return
     */
    @Delete("delete from setmeal_dish where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);
}
